package com.kornero.auto.view;

import com.kornero.auto.util.view.LayoutManager;
import com.kornero.auto.util.view.SWTFactory;
import com.kornero.auto.view.groups.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PropertiesPanel extends Composite {

    private static final Logger logger = LoggerFactory.getLogger(PropertiesPanel.class);

    private IAutoUpdateGroup autoUpdate;
    private IMainGroup main;
    private IEmailGroup email;

    public PropertiesPanel(Composite parent) {
        this(parent, SWT.BORDER);
    }

    public PropertiesPanel(Composite parent, int style) {
        super(parent, style);
        this.constructUI();
    }

    private void constructUI() {
        this.setLayout(LayoutManager.getGridLayout());
        this.setLayoutData(LayoutManager.getLayoutDataFillHorizontal());

        final Composite composite = new Composite(this, SWT.NONE);
        composite.setLayout(LayoutManager.getGridColumnsLayout(3));

        this.autoUpdate = SWTFactory.createObject(new AutoUpdateGroupImpl(composite), IAutoUpdateGroup.class);
        this.main = SWTFactory.createObject(new MainGroupImpl(composite), IMainGroup.class);
        this.email = SWTFactory.createObject(new EmailGroupImpl(composite), IEmailGroup.class);

        this.pack();
    }

    public IAutoUpdateGroup getAutoUpdate() {
        return autoUpdate;
    }

    public IMainGroup getMain() {
        return main;
    }

    public IEmailGroup getEmail() {
        return email;
    }
}
